package com.ddwl.common.feign.byteDance;

import com.ddwl.schema.bo.gate.byteDance.ByteQRCodeBo;
import com.ddwl.schema.vo.gate.byteDance.ByteDanceSessionVo;
import com.ddwl.schema.vo.gate.byteDance.ByteDanceTokenVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @Author hemiaojun
 * @Date 2021/8/3 17:32
 */
@Api(tags = "字节跳动API")
@FeignClient(name = "ByteDanceApi", path = "/apps", url = "https://developer.toutiao.com/api")
public interface ByteDanceApi {

    /**
     * 获取access_token
     * @param appid
     * @param secret
     * @param grant_type
     * @return
     */
    @ApiOperation("获取access_token")
    @GetMapping("/token")
    ByteDanceTokenVo token (@RequestParam("appid") String appid, @RequestParam("secret") String secret, @RequestParam("grant_type") String grant_type);

    /**
     * 登录
     * @param appid
     * @param secret
     * @param code
     * @param anonymous_code
     * @return
     */
    @ApiOperation("登录")
    @GetMapping(value = "/jscode2session")
    ByteDanceSessionVo jscode2session (@RequestParam("appid") String appid, @RequestParam("secret") String secret, @RequestParam(value = "code",required = false) String code,@RequestParam(value = "anonymous_code",required = false) String anonymous_code);

    @ApiOperation("生成二维码")
    @PostMapping(value = "/qrcode")
    feign.Response qrcode(@RequestBody ByteQRCodeBo bo);

}
